package com.green.dao;


/**
 * @author 牛中超
 * @time 2016年6月15号
 * @http://git.oschina.net/jsper
 */

import java.util.Iterator;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.green.domain.Board;

@Repository
public class BoardDao extends BaseDao<Board>{
	protected final String GET_BOARD_NUM = "select count(f.boardId) from Board f";
	protected final String GET_ALL_BOARD = "from Board";

	public long getBoardNum() {    
		Iterator iter = getHibernateTemplate().iterate(GET_BOARD_NUM);
        return ((Long)iter.next());
	}

	/**
	 * 去获取所有的版块信息
	 * @return 返回一个列表信息
     */
	public List getAllBoardList()
	{
		List<Board> list = getHibernateTemplate().find(GET_ALL_BOARD);
		return list;
	}
}
